﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Runtime.Remoting;

namespace CommonLib
{
    /**
   * Esta classe representa uma instancia do server.
   * Deve sempre ser instanciada quando um novo server é adicionado
   **/
    [Serializable]
    public class PServer
    {
        private int id;
        private IPAddress ip;
        private int port;
        private int role; // 0 replica, 1 primary
        private int status; // 0 disconnected, 1 connected

        public PServer()
        {
        }

        public PServer(int newId, IPAddress newIp, int newPort)
        {
            this.id = newId;
            this.ip = newIp;
            this.port = newPort;
            this.status = 1;
        }

        public int Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }


        public IPAddress Ip
        {
            get
            {
                return this.ip;
            }
            set
            {
                this.ip = value;
            }
        }
        public int Port
        {
            get
            {
                return this.port;
            }
            set
            {
                this.port = value;
            }
        }

        public int Role
        {
            get
            {
                return this.role;
            }
            set
            {
                this.role = value;
            }
        }

        public int Status
        {
            get
            {
                return this.status;
            }
            set
            {
                this.status = value;
            }
        }
    }
}
